package cn.com.ahao.nacos.web;

import cn.com.ahao.nacos.vo.dto.BaseResponse;
import cn.com.ahao.nacos.vo.dto.HelloDTO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class NacosHelloController {

    private Logger logger = LoggerFactory.getLogger(this.getClass());

    @GetMapping("/hello")
    public String hello() {
        logger.info("nacos hello");
        return "nacos hello";
    }

    @PostMapping("/hello")
    public BaseResponse<String> hello(@RequestBody HelloDTO request) {
        logger.info("nacos hello post");
        BaseResponse<String> baseResponse = new BaseResponse<>();
        baseResponse.setData(request.toString());
        return baseResponse;
    }
}
